import time

from selenium.webdriver.common.by import By

from common.Untils import QESDriver

# 注册页面
class RegPage:
    url = ""
    driver = ""
    def __init__(self):
        self.url = "http://8.155.1.153:8081/user/login"
        self.driver = QESDriver.driver
        self.driver.get(self.url)

    def GetRegPage(self):
        # 查找注册按钮并点击
        self.driver.find_element(By.CSS_SELECTOR, "#root > div > div.content___2zk1- > div.main___x4OjT > div > form > div:nth-child(4) > a").click()
        # 什么都不输入直接点击注册并截图
        self.driver.find_element(By.XPATH,'//*[@id="root"]/div/div[2]/div[2]/div/form/button').click()
        time.sleep(0.5)
        QESDriver.GetScreenShot()
        ########################################################################################################
        # 查找姓名输入框并输入
        self.driver.find_element(By.XPATH, '//*[@id="name"]').send_keys("小王")
        # 查找登录账号输入框并输入
        self.driver.find_element(By.XPATH,'//*[@id="username"]').send_keys("xiaowang")
        # 查找密码输入框并输入
        self.driver.find_element(By.XPATH,'//*[@id="password"]').send_keys("123456")
        # 查找密码确认输入框并输入
        self.driver.find_element(By.XPATH,'//*[@id="rePassword"]').send_keys("123456")
        # 点击注册
        self.driver.find_element(By.XPATH,'//*[@id="root"]/div/div[2]/div[2]/div/form/button').click()
        time.sleep(0.5)